
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ page import = "com.mysql.jdbc.Driver" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql"%>
<sql:setDataSource driver ="com.mysql.jdbc.Driver"
url="jdbc:mysql://j.snpy.org/j102u08?characterEncoding = UTF-8"
user="j102u08"
password="j102u08.989"
var="ds"
scope="page" 
/>

<sql:query var="rs" dataSource="list">
	<c:choose>
		<c:when test="${empty param.mbrid}">
select * from member 
  </c:when>
		<c:otherwise>
 select * from member where mbrid=?
<sql:param>${param.mbrid}</sql:param>
		</c:otherwise>
	</c:choose>
</sql:query>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
<form action="">
<input type ="text" name="mbrid"/>
<input type ="submit" value="搜尋"/>
</form>
Total: ${rs.rowCount}
<table border="1">
<c:forEach var="p" items="${rs.rows}">

<TR>
<TD>${p.mbrid }</TD>
<TD>${p.name }</TD>
<TD>${p.gender }</TD>
<TD>${p.status }</TD>
<TD>${p.regdattim }</TD>
<TD><a href="updmbr.jsp?id=${p.mbrid }">修改</a></TD>
<TD><a href="delmbr.jsp?id=${p.mbrid }">刪除</a></TD>


</TR>
</c:forEach>
</table>

</body>
</html>

